I have a website with has one subdirectory named "/game". There is no problem when I click the tab in navbar when I execute the website in localhost (localhost:3000/game is working!). But when I want to access using my domain address, it gives me error "404 The requested page was not found." (mydomain/game is not working!)
What am I missing?
React Part - Navbar.js :
...
<a href="/game">
<span>Game</span>
</a>
...
React Part - Game.js :
import React, { Component } from 'react'
export default class Game extends Component {
render() {
return (
<div className='text-white text-center game'>
GAME INFORMATION
</div>
)
}
}
React Part - App.js :
function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={
<div className="App">
<header className='Main-header'>
<Navbar />
<Hero />
</header>
<About />
<Gallery />
<Faq />
</div>
} />
<Route path="/game" element={<Game />} />
</Routes>
</BrowserRouter>
);
}
export default App;
Nginx Part, after typing vi default :
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
server_name _;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Probably just an ssl error. Try to get a certificate from letsencrypt.